package com.rou.im.handler.support;

import com.rou.im.framework.core.Request;
import com.rou.im.framework.core.context.RequestContext;
import com.rou.im.framework.core.Response;
import com.rou.im.framework.core.processorstack.Processor;
import com.rou.im.framework.core.context.RequestContextHolder;
import com.rou.im.framework.core.processorstack.StackInvocation;

/**
 * <p>
 *     获取成功
 * </p>
 *
 * @author GaoShuangWen
 * @since 2020-04-27 21:46
 */
public abstract class SuccessProcessor implements Processor {
    @Override
    public void process(Request request,StackInvocation invocation){
        invocation.invoke(request);
        RequestContext context = RequestContextHolder.getContext();
        onSuccess(request,context.getResponse());
    }
    abstract void onSuccess(Request request, Response response);
}
